#include "gateServer.h"
#include "gateway.h"

int _tmain(int argc, char* argv[])
{
	int size = 0;
	vector<string> configs;
	while(size < argc)
	{
		configs.push_back(argv[size++]);
	}

#ifdef WIN32
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif

	Startup();

	sGateServer.Init(configs);

	while(IsRunning())
	{
		sGateServer.Update();
		SleepMS(10);
	}

	Cleanup();

//#ifdef DEBUG_NEW_DELETE
//	LOG_MSG_INFO_LIST::iterator it;
//	for(it = g_LogMsgInfoList->begin(); it != g_LogMsgInfoList->end(); it++)
//	{
//		LOG_MSG_INFO* pLog = *it;
//		API_PRINTF("pointer: %d, size: %d, file: %s, line: %d\n", pLog->ptr, pLog->size, pLog->file, pLog->line);
//
//		delete pLog;
//	}
//	g_LogMsgInfoList->clear();
//	delete(g_LogMsgInfoList);
//	g_LogMsgInfoList = NULL;
//#endif //DEBUG_NEW_DELETE

	return 0;
}